<?php
require_once '../../bbs/include/common.inc.php';
require_once '../../classes/include.php';
require_once '../../classes/pager.class.php';

//获取记录总数
$count_sql		= "select count(*) as amount from applicant_info";
$count_query	= $db->query($count_sql);
$res_amount		= $db->fetch_array($count_query);
$total_amount	= $res_amount['amount'];
  
/*
 *	翻页类使用(classes/pager.class.php)
 *	传入总共记录数和每页显示条数
 *	$pager->gethtml(); 		得到翻页的html代码，直接打印即可
 *	$pager->get_limit();	拼出sql语句中的limit语句
 *
*/
if( $total_amount > 0 )
{
	$pager		= new pager( $total_amount, $pernum=ADMIN_SHOW_NUMBER);
	$pagers		= $pager->gethtml();
	//$pager_url	= $pager->geturl();
	$limit		= $pager->get_limit();
}else{
	$limit		= 1;
}

$sql = "select * from applicant_info order by id desc limit ".$limit;
$query = $db->query($sql);
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title></title>
<link rel="stylesheet" href="../../bbs/images/admincp/admincp.css" type="text/css" media="all" /> 
</head>
<body bgcolor="#FFFFFF" text="#000000">

  <table cellspacing="1" cellpadding="3" width="100%" align="center" border="0" style="border:1px solid #CCCCCC;">
    <tr class="tablecontent"> 
      <td align="center">姓名</td>
      <td width="50" align="center">性别</td>
      <td width="150" align="center">联系电话</td>
      <td width="150" align="center">Email</td>
      <td width="100" align="center">报名时间</td>
    </tr>
<?php
	$i = 0;
	while($aricle = $db->fetch_array($query)) {
		$i++;
?>
    <tr class="tablecontent"> 
      <td align="left">&nbsp;&nbsp;<a href="info.php?id=<?php echo $aricle['id'];?>"><?php echo $aricle['applicant_username'];?></a></td>
      <td width="150" align="center"><?php if($aricle['sex'] == "1") {echo "男";} else {echo "女";}?></td>
      <td width="150" align="center"><?php echo $aricle['mobile'];?></td>
      <td width="150" align="center"><a href="mailto:<?php echo $aricle['email'];?>"><?php echo $aricle['email'];?></a></td>
      <td width="150" align="center"><?php echo $aricle['submit_time'];?></td>
    </tr>
<?php
	}
	if($i == 0){
		echo "<tr class='tablecontent'>";
    echo "  <td colspan='5' align='center'>暂无报名记录</td>";
    echo "</tr>";
	}
	echo "<tr class='tablecontent'>";
	echo "<td colspan='5' align='center'>" . $pagers . "</td>";
  echo "</tr>";
?>
</table>
</body>
</html>